<template>
	<view class="search">
		<Login></Login>
		<!-- search -->
		<view class="searchpage" style="padding: 66rpx 38rpx 0 40rpx; box-sizing: border-box">
			<div class="employ">
				{{boxName}}
			</div>
			<view class="emplioyfooter">
				<view class="footerlist" v-for="(item,index) in employList" :key="index">
					<view class="">
						{{item.userName}}
					</view>
					<view class="" style="width: 20%; display: flex;justify-content: space-between;">
						<text>添加</text>
						<text>移除</text>
					</view>
				</view>
				<view class="footerlist">
					<view class="">
						邀请新用户
					</view>
					<view class="" style="width: 20%; text-align: center;" @click="onalart">
						<button type="default" open-type="share">邀请</button>
						<!-- <text class="icon1 iconfont icon-tianjia "></text> -->
					</view>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	import Login from "../../common/login/login.vue"
	import request from "../../utlis/request.js";
	import BaseUrl from "../../utlis/api.js"
	export default {
		components: {
			Login
		},
		data() {
			return {
				employName: null,
				boxName: '',
				employList: [],
				boxId: null,
				shareUrlKey: null
			};
		},
		onLoad(option) {
			console.log(option)
			this.boxId = option.boxId;
			this.getGoodsList()
			this.getshareUrlKey()
		},
		methods: {
			onalart() {
				console.log("邀请")
			},
			getGoodsList() {
				const boxIds = this.boxId
				const token = wx.getStorageSync('token') || [];
				uni.request({
					url: BaseUrl + "/wx/sbox/box/" + boxIds,
					method: 'GET',
					header: {
						"Authorization": "Bearer " + token,
					},
					success: (res) => {
						this.employList = res.data.data.sysUsers;
					}
				})
			},
			// 获取shareUrlKey值
			getshareUrlKey() {
				const boxId = this.boxId
				const token = wx.getStorageSync('token') || [];
				uni.request({
					url: BaseUrl + "/wx/sbox/box/shareUrlKey?boxId=" + boxId,
					method: 'POST',
					header: {
						"Authorization": "Bearer " + token,
					},
					success: (res) => {
						this.shareUrlKey = res.data.msg;
						console.log(this.shareUrlKey)
					}
				})
			},
		},
		onShareAppMessage: function() {
			const boxId = this.boxId
			const shareUrlKey = this.shareUrlKey
			return {
				title: '共享盒子',
				desc: '是否共享盒子给好友',
				imageUrl: "",
				path: '/pages/index/index?boxId=' + boxId + '&shareUrlKey=' + shareUrlKey // 路径，传递参数到指定页面。
			}
		}
	};
</script>

<style>
	.search {
		width: 100%;
		height: 100%;
		background-color: #c3b18b;
	}

	.searchpage {
		width: 100%;
		height: 100%;
		background-color: #f9f7f2;
		border-radius: 20rpx;
	}

	.text1 {
		width: 24px;
		height: 17px;
		font-size: 12px;
		font-family: PingFang SC;
		font-weight: bold;
		line-height: 26px;
		color: #000000;
		opacity: 0.6;
		margin-right: 20rpx;
	}

	.text2 {
		width: 48px;
		height: 17px;
		font-size: 12px;
		font-family: PingFang SC;
		font-weight: bold;
		line-height: 26px;
		color: #000000;
		opacity: 0.6;
	}


	.employ {
		height: 50rpx;
		font-size: 36rpx;
		font-family: PingFang SC;
		font-weight: bold;
		line-height: 52rpx;
		color: #000000;
		opacity: 0.7;
	}

	.emplioyfooter {
		width: 100%;
		height: 100%;
		margin-top: 10rpx;
	}

	.footerlist {
		width: 100%;
		height: 110rpx;
		line-height: 100rpx;
		display: flex;
		justify-content: space-between;
		border-bottom: 1px solid #E0DEDB;
	}

	.icon1 {
		color: #707070;
		font-size: 60rpx;
	}

	button {
		display: inline-block;
		margin-top: 10rpx;
	}
</style>
